﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XDeal.BL.Interfaces;
using XDeal.DAL.Implements;
using XDeal.DAL.Entities;

namespace XDeal.BL.Implements
{
    public class CustomerBL: ICustomer
    {
        CustomerDAO customerDAO = new CustomerDAO();
        public CustomerBL() { }

        #region GET (Basic)
        /// <summary>
        /// Get All Deal
        /// </summary>
        /// <returns>List of Deals</returns>
        public List<Customer> GetAll()
        {
            return customerDAO.GetAll();
        }

        /// <summary>
        /// Get Deal by ID
        /// </summary>
        /// <param name="ID">Deal ID</param>
        /// <returns>One Deal</returns>
        public Customer GetByID(int ID)
        {
            return customerDAO.GetByID(ID);
        }
        #endregion

        #region GET ADVANCE
        /// <summary>
        /// Lay danh sach Customer theo dia chi mail.(Neu co)
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public List<Customer> GetCustomerByEmail(string email)
        {
            return customerDAO.GetCustomerByEmail(email);
        }
        public Customer DoLogIn(string email, string pass)
        {
            return customerDAO.DoLogIn(email, pass);
        }
        #endregion

        #region Insert, Update, Delete
        /// <summary>
        /// Insert Customer
        /// </summary>
        /// <param name="ob">Customer Object</param>
        /// <returns>True: Successful | False: Fail</returns>
        public bool Insert(Customer bo)
        {
            return customerDAO.Insert(bo);
        }

        /// <summary>
        /// Update Customer by Object
        /// </summary>
        /// <param name="ob">Customer Object</param>
        /// <returns>True: Successful | False: Fail</returns>
        public bool Update(Customer bo)
        {
            return customerDAO.Update(bo);
        }

        /// <summary>
        /// Delete Customer by Object
        /// </summary>
        /// <param name="ob">Customer Object</param>
        /// <returns>True: Successful | False: Fail</returns>
        public bool Delete(Customer bo)
        {
            return customerDAO.Delete(bo);
        }

        /// <summary>
        /// Delete By ID
        /// </summary>
        /// <param name="ID">Customer ID</param>
        /// <returns>True: Successful | False: Fail</returns>
        public bool Delete(int ID)
        {
            return customerDAO.Delete(ID);
        }
        #endregion
    }
}
